package com.yuanluludev.lib_base.ext

import android.view.Gravity
import android.widget.Toast
import com.yuanluludev.lib_base.R
import com.yuanluludev.lib_base.application.BaseApplication
import com.yuanluludev.lib_utils.util.ColorUtils
import com.yuanluludev.lib_utils.util.ToastUtils

/**
 * 短显示toast(String)
 */
fun String.showShort() {
    ToastUtils.showShort(this)
}

/**
 * 长显示toast(String)
 */
fun String.showLong() {
    ToastUtils.showLong(this)
}

/**
 * 显示中间toast带图片(提示)
 */
fun String.toastTipMiddle() {
    ToastUtils.make().setGravity(Gravity.CENTER, 0, 0)
        .setTopIcon(R.drawable.toast_tip_image)
        .setBgResource(R.drawable.bg_toast_middel)
        .setTextColor(ColorUtils.getColor(R.color.color_ffffff))
        .setDurationIsLong(false)
        .show(this)
}

/**
 * 显示中间toast带图片(成功)
 */
fun String.toastSuccessMiddle() {
    ToastUtils.make().setGravity(Gravity.CENTER, 0, 0)
        .setTopIcon(R.drawable.toast_tip_success)
        .setBgResource(R.drawable.bg_toast_middel)
        .setTextColor(ColorUtils.getColor(R.color.color_ffffff))
        .setDurationIsLong(false)
        .show(this)
}


/**
 * 显示中间toast带图片(失败)
 */
fun String.toastFailedMiddle() {
    ToastUtils.make().setGravity(Gravity.CENTER, 0, 0)
        .setTopIcon(R.drawable.toast_tip_failed)
        .setBgResource(R.drawable.bg_toast_middel)
        .setTextColor(ColorUtils.getColor(R.color.color_ffffff))
        .setDurationIsLong(false)
        .show(this)
}



